package main

import (
	"gitee.com/scottq/go-framework/src/miscs"
	v1job "gitee.com/scottq/go-framework/src/v1/jobserver"
	"time"
)

func main() {

	//创建一个job
	job := v1job.NewJob("printX", func() {
		for i := 0; i <= 10; i++ {
			println(i)
			time.Sleep(time.Millisecond * 500)
		}
	})

	//创建runner
	jobRunner := v1job.NewJobRunner("printXCo")
	jobRunner.AddJob(job) //添加job
	jobRunner.AddExecute("printTime", func() {
		for i := 0; i <= 10; i++ {
			println(time.Now().Format(miscs.DateTimeLayout))
			time.Sleep(time.Second)
		}
	}) //添加自定义执行job

	//
	jobRunner.Run()
}
